package com.jwm.power.repository;

import com.jwm.power.model.entity.XsfwCussource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
public interface XsfwCussourceRepository extends JpaRepository<XsfwCussource, Integer>, JpaSpecificationExecutor<XsfwCussource> {
    //  获取最大编码
    @Query(value = "select top 1 RIGHT(code,2) from Xsfw_CusSource where ParentCode=?1 order by code DESC ", nativeQuery = true)
    String getMaxCode(String parentCode);
    //  获取最大序号
    @Query(value = "select top 1 orderbyid from Xsfw_CusSource where ParentCode=?1 order by orderbyid DESC ", nativeQuery = true)
    Integer getMaxSn(String parentCode);
}
